# Contributor: Bart Ribbers <bribbers@disroot.org>
# Maintainer: Bart Ribbers <bribbers@disroot.org>
pkgname=py3-memory-profiler
pkgver=0.61
pkgrel=1
pkgdesc="A module for monitoring memory usage of a python program"
url="https://github.com/pythonprofilers/memory_profiler"
arch="noarch"
license="Apache-2.0"
depends="py3-psutil"
makedepends="
	py3-gpep517
	py3-setuptools
	py3-wheel
	"
checkdepends="
	py3-pytest
	"
subpackages="$pkgname-pyc"
source="$pkgname-$pkgver.tar.gz::https://github.com/pythonprofilers/memory_profiler/archive/refs/tags/v$pkgver.tar.gz
	assertRaisesRegexp.patch
	"
builddir="$srcdir/memory_profiler-$pkgver"

build() {
	gpep517 build-wheel \
		--wheel-dir .dist \
		--output-fd 3 3>&1 >&2
}

check() {
	python3 -m venv --clear --without-pip --system-site-packages .testenv
	.testenv/bin/python3 -m installer .dist/*.whl
	.testenv/bin/python3 -m memory_profiler test/test_func.py
	.testenv/bin/python3 -m memory_profiler test/test_loop.py
	.testenv/bin/python3 -m memory_profiler test/test_mprofile.py
	.testenv/bin/python3 -m memory_profiler test/test_as.py
	.testenv/bin/python3 -m memory_profiler test/test_global.py
	.testenv/bin/python3 -m memory_profiler test/test_precision_command_line.py
	.testenv/bin/python3 -m memory_profiler test/test_gen.py
	.testenv/bin/python3 -m memory_profiler test/test_unicode.py
	.testenv/bin/python3 test/test_tracemalloc.py
	.testenv/bin/python3 test/test_import.py
	.testenv/bin/python3 test/test_memory_usage.py
	.testenv/bin/python3 test/test_precision_import.py
	.testenv/bin/python3 test/test_exception.py
	.testenv/bin/python3 test/test_exit_code.py
	.testenv/bin/python3 test/test_mprof.py
	.testenv/bin/python3 test/test_async.py
}

package() {
	python3 -m installer -d "$pkgdir" \
		.dist/*.whl
}

sha512sums="
02c70a049107ad4df635e20e22eaaa91fd4e4fd29690b0a7c314e08ed6e076bbb81f85dd97924ed35f7f0133cfd3c7e55b35400449489733beb172debe592c4e  py3-memory-profiler-0.61.tar.gz
a15ff3b422fd0c7c32376e845612d163b587542fed292fe6fc931b1010785574bf255f724feac64911b1d89e4ddf04c5515084da908eb94674ae2490c290989d  assertRaisesRegexp.patch
"
